﻿//regex date

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using SchoolProject2012.Langue;

namespace SchoolProject2012.Domain
{
    [MetadataType(typeof(EleveCV))]
    public class Eleve
    {
        public string login { get; set; }
        public string mdp { get; set; }
        public string nom { get; set; }
        public string prenom { get; set; }
        public DateTime dateNaiss { get; set; }
        public string mail { get; set; }
        public string telephone { get; set; }
        public string adresse { get; set; }
        public string ville { get; set; }
        public string codePostal { get; set; }
        public string idChargeP { get; set; }
        public List<Contrat> contrats { get; set; }

        #region controle de validite
        public class EleveCV
        {
            public string login { get; set; }
            public string mdp { get; set; }
            public string nom { get; set; }
            public string prenom { get; set; }
            public DateTime dateNaiss { get; set; }
            [StringLength(255)]
            [DataType(DataType.EmailAddress)]
            [RegularExpression(@"^[a-z0-9.-]+@[a-z0-9.-]{2,}\.[a-z]{2,4}$", ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "ErrorMessageMail")]
            [Display(ResourceType = typeof(Resources), Name = "lblCompanyMail")]
            public string mail { get; set; }
            [StringLength(50)]
            [DataType(DataType.PhoneNumber)]
            [RegularExpression(@"^[0-9.+()\s-]*$", ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "ErrorMessageMail")]
            public string telephone { get; set; }
            public string adresse { get; set; }
            public string ville { get; set; }
            [StringLength(5)]
            public string codePostal { get; set; }
            public int idClasse { get; set; }
            public string idChargeP { get; set; }

            public EleveCV() { }

            public EleveCV(Eleve e)
            {
                login = e.login;
                mdp = e.mdp;
                nom = e.nom;
                prenom = e.prenom;
                dateNaiss = e.dateNaiss;
                mail = e.mail;
                telephone = e.telephone;
                adresse = e.adresse;
                ville = e.ville;
                codePostal = e.codePostal;
                idChargeP = e.idChargeP;
            }
        }
       
        #endregion


    }
}